import numpy as np
x = np.array([1.0,2.0,3.0])
print(x)

#算术运算
x = np.array([1.0,2.0,3.0])
y = np.array([2.0,4.0,6.0])
print(x+y)
print(x-y)
print(x*y)
print(x/y)

#N 维数组
print("N 维数组")
A = np.array([[2.0,4.],[6.0,8.0]])
print(A)
print(A.shape)
print(A.dtype)

B = np.array([[2.0,4.0],[6.0,8.0],[10.0,12.0]])
for x,y in B:

    print(x,y)

for row in B:
    print(row)
print(type(B))

# 变形为一维数组
print("变形为一维数组")
X = B.flatten()
print(X)
print(X[np.array([0,2,4])])

